<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %><%--
  Created by IntelliJ IDEA.
  User: 32104
  Date: 2024/6/16
  Time: 上午9:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>全部删除</title>
</head>
<body>
<%
    Connection connection = null;
    Statement statement = null;
    try {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/student?serverTimezone=Asia/Shanghai";
        String user = "root";
        String password = "root";
        connection = DriverManager.getConnection(url, user, password);
        String deleteSql = "delete from user_info";
        statement = connection.createStatement();
        int i = statement.executeUpdate(deleteSql);
        if (i>0){
%>
<script type="text/javascript">
    alert("删除成功");
    window.location.href="../select/select01.jsp";
</script>
<%        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            if (null != connection) {
                connection.close();
            }
            if (null != statement) {
                statement.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
%>
</body>
</html>
